import type { TableColumn } from '@/components/core/dynamic-table';

export type TableListItem = API.UserListPageResultItem;
export type TableColumnItem = TableColumn<TableListItem>;

const operationParams = [
  {
    label: '直接入库',
    value: 1,
  },
  {
    label: '采购入库',
    value: 2,
  },
];
const operationParams2 = [
  {
    label: '全部状态',
    value: '',
  },
  {
    label: '未完成',
    value: 1,
  },
  {
    label: '已完成',
    value: 2,
  },
];

export const baseColumns: TableColumn[] = [
  {
    title: '关键字',
    align: 'left',
    dataIndex: 'keyword',
    hideInTable: true,
    formItemProps: {
      labelWidth: 55,
      componentProps: () => {
        return {
          placeholder: '可输入项目名/机台名/操作人搜索',
          disabledLabelWidth: true,
        };
      },
    },
  },
  {
    title: '入库状态',
    align: 'left',
    dataIndex: 'type2',
    formItemProps: {
      component: 'Select',
      componentProps: {
        options: operationParams2,
        defaultValue: '',
      },
    },
    customRender: ({ record }) =>
      operationParams2.filter((item) => item.value == record.type2)[0].label,
  },
  {
    title: '入库类型',
    align: 'left',
    dataIndex: 'type',
    formItemProps: {
      component: 'Select',
      componentProps: {
        options: operationParams,
      },
    },
    customRender: ({ record }) =>
      operationParams.filter((item) => item.value == record.type)[0].label,
  },
  {
    title: '入库日期',
    align: 'left',
    dataIndex: 'userLogin',
    hideInSearch: true,
  },

  {
    title: '入库总数量',
    align: 'left',
    dataIndex: 'userName',
    hideInSearch: true,
  },
  {
    title: '入库总金额',
    align: 'left',
    dataIndex: 'action',
    hideInSearch: true,
  },

  {
    title: '操作人',
    align: 'left',
    dataIndex: 'operationName',
    hideInSearch: true,
  },
  {
    title: '最后操作时间',
    align: 'left',
    dataIndex: 'operationUser',
    hideInSearch: true,
  },
];
